// 注册业务
const btnRegister = document.querySelector('#btn-register')
const form = document.querySelector('.register-form')
btnRegister.addEventListener('click', async function () {
    const data = serialize(form, { hash: true, empty: true })
    // console.log(data);
    const { username, password } = data
    // console.log(username);

    if (username.length > 8 && username.length < 30) {

    } else {
        return showToast('请输入8-30位账号')
    }
    if (password.length > 6 && password.length < 30) {

    } else {
        return showToast('请输入6-30位密码')
    }
    const{ message } = await axios.post('/register', data)
    showToast(message)
})